/**
 * Created by Freeman on 2017/7/11.
 */
const mongoose = require('mongoose')
const Schema = mongoose.Schema

const UserSchema = new Schema({
  username: {type: String, required: true}, // 用户名
  nickname: {type: String, required: true}, // 昵称
  phone: {type: Number},
  avatar: {type: String, default: ''},    // 头像
  profile: {type: String, default: ''},   // 个人简介
  password: {type: String, required: true},//密码
  created: {type: Date, default: Date.now},
  updated: {type: Date, default: Date.now},
  role: {type: String, default: 'ROLE_USER'},//角色
})
const User = mongoose.model('User', UserSchema)
mongoose.Promise = global.Promise
module.exports = User